package com.whw.fy.controller;

import com.whw.fy.entity.Message;
import com.whw.fy.entity.Plans;
import com.whw.fy.service.PlansService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Date;

@Api(tags = "新计划模块")
@RestController
@RequestMapping("/api/plans")
public class PlansController {
    @Resource
    private PlansService plansService;

    @ApiOperation(value = "添加计划信息")
    @PostMapping("/one")
    public Message insert(Plans plans) {
        plans.setPlansTime(new Date());
        return plansService.insertSelective(plans);
    }

    @ApiOperation(value = "删除计划")
    @DeleteMapping("/")
    public Message delete(Integer plansId) {
        return plansService.deleteByPrimaryKey(plansId);
    }

    @ApiOperation(value = "修改计划")
    @PutMapping("/")
    public Message update(Plans plans) {
        return plansService.updateByPrimaryKeySelective(plans);
    }

    @ApiOperation(value = "获取所有计划")
    @GetMapping("/all")
    public Message selectAll(){
        return plansService.selectAll();
    }

    @ApiOperation(value = "根据计划id获取计划")
    @GetMapping("/one")
    public Message selectByPrimaryKey(Integer plansId){
        return plansService.selectByPrimaryKey(plansId);
    }

    @ApiOperation(value = "根据班级Id获取计划")
    @GetMapping("/classId")
    public Message selectByClassId(Integer classId){
        return plansService.selectByClassId(classId);
    }

    @ApiOperation(value = "根据学生id获得计划")
    @GetMapping("/studentId")
    public Message selectByPlansStudentId(Integer plansStudentId){
        return plansService.selectByPlansStudentId(plansStudentId);
    }

    @ApiOperation(value = "根据授课老师id查询旗下获取所有计划")
    @GetMapping("/all/TeacherIdJurisdictionEight")
    public Message selectallByTeacherIdJurisdictionEight(int staffId){
        return plansService.selectallByTeacherIdJurisdictionEight(staffId);
    }

    @ApiOperation(value = "根据医疗主管id查询旗下所有计划")
    @GetMapping("/all/MedicalDirectorIdJurisdictionZero")
    public Message selectallByMedicalDirectorIdJurisdictionZero(int staffId){
        return plansService.selectallByMedicalDirectorIdJurisdictionZero(staffId);
    }

    @ApiOperation(value = "根据教学主管id查询旗下所有计划")
    @GetMapping("/all/TeachingDirectorJurisdictionSix")
    public Message selectallByTeachingDirectorJurisdictionSix(int staffId){
        return plansService.selectallByTeachingDirectorJurisdictionSix(staffId);
    }

    @ApiOperation(value = "根据主责老师id查询旗下所有计划")
    @GetMapping("/all/principalTeacherJurisdictionSeven")
    public Message selectallByprincipalTeacherJurisdictionSeven(int staffId){
        return plansService.selectallByprincipalTeacherJurisdictionSeven(staffId);
    }
}
